import request from '@/utils/request'

export function getMineralUsableList(query) {
  let baseUrl = "/geography/mineral"
  if(query != undefined){
    if(typeof query == "object"){
      console.log(query)
      if(query.hasOwnProperty('mineralID')){
        query['mineralID'] = parseInt(query['mineralID'])
        if(isNaN(query['mineralID']) == false){
          baseUrl = baseUrl+"-"+query['mineralID']
        }
      }
    }
  }
  return request({
    url: baseUrl,
    method: 'get'
  })
}

export function getMineralList(query) {
  return request({
    url: '/geography/admin/mineral/getList',
    method: 'post',
    data: query
  })
}
export function saveMineral(query) {
  return request({
    url: '/geography/admin/mineral/save',
    method: 'post',
    data: query
  })
}

export function removeMineral(query) {
  return request({
    url: '/geography/admin/mineral/remove',
    method: 'post',
    data: query
  })
}
export function getMineralDetail(query) {
  if(query != undefined){
    query = JSON.parse(JSON.stringify(query))
  }
  return request({
    url: '/geography/admin/mineral/info/0',
    method: 'get',
    data: query
  })
}